<?php
$this->breadcrumbs=array(
	Yii::t('labs', 'Labs')=>array('index'),
	Project::model()->getBrifeDescript($model),
);

$this->menu=array(
	array('label'=>'List Project', 'url'=>array('index')),
	array('label'=>'Create Project', 'url'=>array('create')),
	array('label'=>'Update Project', 'url'=>array('update', 'id'=>$model->pro_id)),
	array('label'=>'Delete Project', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->pro_id),'confirm'=>'Are you sure you want to delete this item?')),
	array('label'=>'Manage Project', 'url'=>array('admin')),
);
?>
<?php $this->widget('ext.code.syntaxhighlighter.syntaxhighlighterWidget');?>
<div class="articlePanel panelsContainer">
	<?php $this->widget('application.components.link.LabsPrevNextWidget',array(
		'id'=>$model->pro_id
	))?>
	<hr />
	<div id="articlePage">
		<div id="articleContent">	
			<div style="border:1px dashed grey;font-style:italic;">
			实验课题：<?php echo $model->pro_introduce;?><br />
			<?php echo Yii::t('common','<span>Post By {user} On {time} Hits {hits}　{link}</span>',array(
				'{user}'=> $model->user->user_name,
				'{time}' => UtilTools::timeop($model->pro_created),
				'{hits}' => $model->pro_hits,
				'{link}' => UtilAuth::getAuthLinks('编辑', array('update','id'=>$model->pro_id))
			));?>
			</div>
			<hr class="space" />
			<div class="right">
				<span class="parallaxIco parallaxInfoButton"><?php echo CHtml::link('创建新课题', array('create'));?></span>
				<span class="parallaxIco parallaxInfoButton"><?php echo CHtml::link('创建新解决方案', array('solution','id'=>$model->pro_id));?></span>
			</div>
			<hr class="space" />
		
			<div class="parallaxTabPanel" style="margin-top:-35px;">
				<ul>
					<li><a href="#tabs-1">已有解决方案</a></li>
				</ul>
				<div id="tabs-1">

					<?php $this->widget('zii.widgets.CListView', array(
						'dataProvider'=>$solution,
						'itemView'=>'_sview',
						'template'=>"{summary}\n{sorter}\n{items}\n{pager}"	
					)); ?>
				</div>

				
			</div>
			
		</div>	
		
		<hr class="space" />
	</div>	
	<hr style="height:1px; padding:0px; margin:0px;"/>	
	<?php $this->widget('application.components.link.LabsPrevNextWidget',array(
		'id'=>$model->pro_id
	))?>
	<hr style="height:0px;" />
</div>
<?php 
//定义URL地址
$createUrl = $this->createUrl('/labs/solution');
?>
<script type="text/javascript" language="javascript">
$(function(){
	$(".parallaxTabPanel").tabs();

	$(".parallaxLabItem").each(function(i){
		i = i + 1;
		$(this).find(".parallaxIco").html(i);

	});
	
	$("#parallaxButton").click(function(){

		if(editor_a.hasContents()){
			
			var data = {
				'Solution[sol_pid]':<?php echo $_GET['id']; ?>,
				'Solution[sol_content]':editor_a.getContent(),
				'rn':Math.random()
			};

			$.post('<?php echo $createUrl;?>', data, function(msg){

				msg = msg.split('_#_');

				if(msg[0] == 'success'){
				    $.msgbox({
					    height:100,
					    width:300,
					    content:{type:'confirm', content: '现在添加新的项目解决方案吗？<br /><a href="<?php echo $this->createUrl('create');?>">我的新问题……</a>'},
					    animation:4,
					    onClose:function(v){
					        if(v){	                   
					        	location.href = '<?php echo $this->createUrl('solution',array('id'=>$_GET['id']));?>';
					      
					        }else{
								location.href = msg[1];<?php //echo $this->createUrl('list');?>
					        }
					        
					    }
					}); 
				}
				
				console.log(msg);
			});			
			
		}else{
		    $.msgbox({
			    height:100,
			    width:300,
			    content:{type:'alert', content: '课题解决方案内容简介不能为空！'},
			    animation:4

			}); 
		}
	});
});
</script>